package UML_ER.diagram.edit.parts;

import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;

import UML_ER.diagram.part.UML_ERVisualIDRegistry;

/**
 * @generated
 */
public class UML_EREditPartFactory implements EditPartFactory {

	/**
	 * 
	 */
	public EditPart createEditPart(EditPart context, Object model) {
		if (model instanceof View) {
			View view = (View) model;
			switch (UML_ERVisualIDRegistry.getVisualID(view)) {

			case ERmodelEditPart.VISUAL_ID:
				return new ERmodelEditPart(view);

			case EntityEditPart.VISUAL_ID:
				return new EntityEditPart(view);

			case RelationshipEditPart.VISUAL_ID:
				return new RelationshipEditPart(view);

			case RelationshipNameEditPart.VISUAL_ID:
				return new RelationshipNameEditPart(view);

			case RoleEditPart.VISUAL_ID:
				return new RoleEditPart(view);

			case RoleNameEditPart.VISUAL_ID:
				return new RoleNameEditPart(view);

			case RoleName2EditPart.VISUAL_ID:
				return new RoleName2EditPart(view);

			case EntityAttributesEditPart.VISUAL_ID:
				return new EntityAttributesEditPart(view);

			case EntityAttributes2EditPart.VISUAL_ID:
				return new EntityAttributes2EditPart(view);

			case EntityNameEditPart.VISUAL_ID:
				return new EntityNameEditPart(view);

			case BinaryRelationshipEditPart.VISUAL_ID:
				return new BinaryRelationshipEditPart(view);

			case AttributeEditPart.VISUAL_ID:
				return new AttributeEditPart(view);

			case OntologyReferenceEditPart.VISUAL_ID:
				return new OntologyReferenceEditPart(view);

			case OntologyReferenceRelationshipEditPart.VISUAL_ID:
				return new OntologyReferenceRelationshipEditPart(view);

			case Attribute2EditPart.VISUAL_ID:
				return new Attribute2EditPart(view);

			case GeneralizationEditPart.VISUAL_ID:
				return new GeneralizationEditPart(view);

			case BinaryRelationship2EditPart.VISUAL_ID:
				return new BinaryRelationship2EditPart(view);

			case BinaryRelationshipNameEditPart.VISUAL_ID:
				return new BinaryRelationshipNameEditPart(view);

			case BinaryRelationshipName2EditPart.VISUAL_ID:
				return new BinaryRelationshipName2EditPart(view);

			case BinaryRelationshipName3EditPart.VISUAL_ID:
				return new BinaryRelationshipName3EditPart(view);

			case BinaryRelationshipName4EditPart.VISUAL_ID:
				return new BinaryRelationshipName4EditPart(view);

			case BinaryRelationshipName5EditPart.VISUAL_ID:
				return new BinaryRelationshipName5EditPart(view);

			case BinaryRelationshipName6EditPart.VISUAL_ID:
				return new BinaryRelationshipName6EditPart(view);

			case BinaryRelationshipAttributesEditPart.VISUAL_ID:
				return new BinaryRelationshipAttributesEditPart(view);

			case BinaryRelationshipTargetEditPart.VISUAL_ID:
				return new BinaryRelationshipTargetEditPart(view);

			case AggregationEditPart.VISUAL_ID:
				return new AggregationEditPart(view);

			case AggregationNameEditPart.VISUAL_ID:
				return new AggregationNameEditPart(view);

			case AggregationName2EditPart.VISUAL_ID:
				return new AggregationName2EditPart(view);

			case CompositionEditPart.VISUAL_ID:
				return new CompositionEditPart(view);

			case CompositionNameEditPart.VISUAL_ID:
				return new CompositionNameEditPart(view);

			case CompositionName2EditPart.VISUAL_ID:
				return new CompositionName2EditPart(view);

			}
		}
		return createUnrecognizedEditPart(context, model);
	}

	/**
	 * @generated
	 */
	private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
		// Handle creation of unrecognized child node EditParts here
		return null;
	}

	/**
	 * @generated
	 */
	public static CellEditorLocator getTextCellEditorLocator(
			ITextAwareEditPart source) {
		return CellEditorLocatorAccess.INSTANCE
				.getTextCellEditorLocator(source);
	}
}
